package myschool.array.homework;

import java.util.Scanner;

public class RecursiveAlgorithm {
    public static int algorithm (int number){
        if(number < 0){
            return 0;
        }else if(number ==1 || number == 0){
            return 1;
        }else{
            return number*algorithm(number-1);
        }
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入数字（求这个数的阶乘）：");
        int number = input.nextInt();
        System.out.println(algorithm(number));


    }
}
